#pragma once
#include<iostream>
#include<unistd.h>
#include<Epoller.hpp>
#include<Com.hpp>
#include<Socket.hpp>
#include<EventLoop.hpp>
#include<map>
#include"connection.hpp"
using namespace SocketMoule;
class Reactor{
    private:
        std::unique_ptr<EventLoop>eventLoop;
    public:
        Reactor():
        eventLoop(std::make_unique<EventLoop>())
        {}
        void start(){
            eventLoop->setrunning(true);
            eventLoop->Loop();
            eventLoop->setrunning(false);
        }
        void stop(){
            eventLoop->setrunning(false);
        }
        void addconnection(std::shared_ptr<connection> conn){
            eventLoop->addconnection(conn);
        }
};